﻿using MusicPlayerPlus.Core.Reflection.ActionParam;
using MusicPlayerPlus.Interface.Model.Enum;
using MusicPlayerPlus.Interface.Model.Muisc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MusicPlayerPlus.Core
{
    public class Interactive
    {
        public Interactive()
        {
            CoreData.Dictionary_Change = (guid, val) =>
            {
                if (DictionaryChange_Event != null)
                {
                    DictionaryChange_Event(guid, val);
                }
            };
            CoreData.MuiscList_Change = (val) =>
            {
                if (MuiscListChange_Event != null)
                {
                    MuiscListChange_Event(val);
                }
            };
            CoreData.PlayMusic_Change = (val) =>
            {
                if (PlayMusicChange_Event != null)
                {
                    PlayMusicChange_Event(val);
                }
            };
            CoreData.PlayList_Change = (guid, val) =>
            {
                if (PlayListChange_Event != null)
                {
                    PlayListChange_Event(guid, val);
                }
            };
            InitActionParam();
        }
        #region Interactive

        #region Input_Event

        #region Base

        /// <summary>
        /// 自动执行动作接口
        /// </summary>
        public event System.Action AutoExecute_Event;
        /// <summary>
        /// 添加按钮动作接口
        /// </summary>
        public event Action<string, System.Action> AddToButton_Event;
        /// <summary>
        /// 添加菜单动作接口
        /// </summary>
        public event Action<string, System.Action> AddToMenu_Event;

        /// <summary>
        /// 设置主窗体
        /// </summary>
        public event Action<object> SetMainWindow_Event;
        /// <summary>
        /// 主窗体 显示
        /// </summary>
        public event System.Action MainWindowShow_Event;
        /// <summary>
        /// 主窗体 隐藏
        /// </summary>
        public event System.Action MainWindowHide_Event;
        /// <summary>
        /// 主窗体 最小化
        /// </summary>
        public event System.Action MainWindowMin_Event;
        /// <summary>
        /// 主窗体 最大化
        /// </summary>
        public event System.Action MainWindowMax_Event;
        #endregion

        #region Media

        /// <summary>
        /// (改变后事件)进度条改变
        /// </summary>
        public event Action<double, double> TimeLineChange_Event;
        /// <summary>
        /// (主动)进度条改变
        /// </summary>
        public event Action<double> ChangeTimeLine_Event;
        /// <summary>
        /// 缓冲进度条改变
        /// </summary>
        public event Action<double, double> BufferingTimeLineChange_Event;
        /// <summary>
        /// (改变后事件)音量改变
        /// </summary>
        public event Action<double> VolumeChange_Event;
        /// <summary>
        /// (主动)音量改变
        /// </summary>
        public event Action<double> ChangeVolume_Event;
        /// <summary>
        /// 播放状态改变
        /// </summary>
        public event Action<MediaPlayState> PlayStateChange_Event;
        /// <summary>
        /// 播放顺序改变
        /// </summary>
        public event Action<MediaPlayPlayOrder> PlayPlayOrderChange_Event;
        /// <summary>
        /// 播放
        /// </summary>
        public event System.Action Play_Event;
        /// <summary>
        /// 暂停
        /// </summary>
        public event System.Action Pause_Event;
        /// <summary>
        /// 停止
        /// </summary>
        public event System.Action Stop_Event;
        /// <summary>
        /// 上一首
        /// </summary>
        public event System.Action PreviousTrack_Event;
        /// <summary>
        /// 下一首
        /// </summary>
        public event System.Action NextTrack_Event;

        #endregion

        #region Data

        /// <summary>
        /// Dictionary数据改变时
        /// </summary>
        public event Action<Guid, object> DictionaryChange_Event;
        /// <summary>
        /// 播放列表改变时
        /// </summary>
        public event Action<Guid, PlayList> PlayListChange_Event;
        /// <summary>
        /// 播放中的列表改变时
        /// </summary>
        public event Action<Dictionary<Guid, MusicItem>> MuiscListChange_Event;
        /// <summary>
        /// 播放的歌曲改变时
        /// </summary>
        public event Action<MusicItem> PlayMusicChange_Event;

        #endregion

        #endregion

        #region Output_Function

        #region Base

        /// <summary>
        /// 输出信息到日志接口
        /// </summary>
        public void InputLog_Function(string data)
        {

        }
        /// <summary>
        /// 添加按钮动作接口
        /// </summary>
        public void AddToButton_Function(string title, Action action)
        {
            if (AddToButton_Event != null)
            {
                AddToButton_Event(title, action);
            }
        }
        /// <summary>
        /// 添加菜单动作接口
        /// </summary>
        public void AddToMenu_Function(string title, Action action)
        {
            if (AddToMenu_Event != null)
            {
                AddToMenu_Event(title, action);
            }
        }

        /// <summary>
        /// 设置主窗体
        /// </summary>
        public void SetMainWindow_Function(object win)
        {
            if (SetMainWindow_Event != null)
            {
                SetMainWindow_Event(win);
            }
        }
        /// <summary>
        /// 主窗体 显示
        /// </summary>
        public void MainWindowShow_Function()
        {
            if (MainWindowShow_Event != null)
            {
                MainWindowShow_Event();
            }
        }
        /// <summary>
        /// 主窗体 隐藏
        /// </summary>
        public void MainWindowHide_Function()
        {
            if (MainWindowHide_Event != null)
            {
                MainWindowHide_Event();
            }
        }

        #endregion

        #region Media

        /// <summary>
        /// (改变后事件)进度条改变
        /// </summary>
        public void TimeLineChange_Function(double max, double val)
        {
            if (TimeLineChange_Event != null)
            {
                TimeLineChange_Event(max, val);
            }
        }
        /// <summary>
        /// (主动)进度条改变
        /// </summary>
        public void ChangeTimeLine_Function(double val)
        {
            if (ChangeTimeLine_Event != null)
            {
                ChangeTimeLine_Event(val);
            }
        }
        /// <summary>
        /// 缓冲进度条改变
        /// </summary>
        public void BufferingTimeLineChange_Function(double max, double val)
        {
            if (BufferingTimeLineChange_Event != null)
            {
                BufferingTimeLineChange_Event(max, val);
            }
        }
        /// <summary>
        /// (改变后事件)音量改变
        /// </summary>
        public void VolumeChange_Function(double val)
        {
            if (VolumeChange_Event != null)
            {
                VolumeChange_Event(val);
            }
        }
        /// <summary>
        /// (主动)音量改变
        /// </summary>
        public void ChangeVolume_Function(double val)
        {
            if (ChangeVolume_Event != null)
            {
                ChangeVolume_Event(val);
            }
        }
        /// <summary>
        /// 播放状态改变
        /// </summary>
        public void PlayStateChange_Function(MediaPlayState state)
        {
            if (PlayStateChange_Event != null)
            {
                PlayStateChange_Event(state);
            }
        }
        /// <summary>
        /// 播放顺序改变
        /// </summary>
        public void PlayPlayOrderChange_Function(MediaPlayPlayOrder order)
        {
            if (PlayPlayOrderChange_Event != null)
            {
                PlayPlayOrderChange_Event(order);
            }
        }
        /// <summary>
        /// 播放
        /// </summary>
        public void Play_Function()
        {
            if (Play_Event != null)
            {
                Play_Event();
            }
        }
        /// <summary>
        /// 暂停
        /// </summary>
        public void Pause_Function()
        {
            if (Pause_Event != null)
            {
                Pause_Event();
            }
        }
        /// <summary>
        /// 停止
        /// </summary>
        public void Stop_Function()
        {
            if (Stop_Event != null)
            {
                Stop_Event();
            }
        }
        /// <summary>
        /// 上一首
        /// </summary>
        public void PreviousTrack_Function()
        {
            if (PreviousTrack_Event != null)
            {
                PreviousTrack_Event();
            }
        }
        /// <summary>
        /// 下一首
        /// </summary>
        public void NextTrack_Function()
        {
            if (NextTrack_Event != null)
            {
                NextTrack_Event();
            }
        }

        #endregion

        #region MusicList

        /// <summary>
        /// 获取列表
        /// </summary>
        public IList<MusicItem> GetMusicList_Function()
        {
            return CoreData.GetMusicList();
        }
        /// <summary>
        /// 改变列表
        /// </summary>
        public void ChangeMusicList_Function(Guid guid)
        {
            CoreData.ChangeMusicList(guid);
        }
        /// <summary>
        /// 添加列表
        /// </summary>
        public void AddMusicList_Function(IList<MusicItem> list)
        {
            CoreData.AddMusicList(list);
        }
        /// <summary>
        /// 获取播放的音乐
        /// </summary>
        public MusicItem GetPlayMusic_Function()
        {
            return CoreData.GetPlayMusic();
        }
        /// <summary>
        /// 设置播放的音乐
        /// </summary>
        public void SetPlayMusic_Function(MusicItem item)
        {
            CoreData.SetPlayMusic(item);
        }
        /// <summary>
        /// 添加歌曲
        /// </summary>
        public void AddMusic_Function(MusicItem item)
        {
            CoreData.AddMusic(item);
        }
        /// <summary>
        /// 改变歌曲
        /// </summary>
        public void ChangeMusic_Function(MusicItem item)
        {
            CoreData.ChangeMusic(item);
        }
        /// <summary>
        /// 删除歌曲
        /// </summary>
        public void DeleteMusic_Function(MusicItem item)
        {
            CoreData.DeleteMusic(item);
        }

        #endregion

        #region PlayList

        /// <summary>
        /// 获取所有的播放列表
        /// </summary>
        public IList<PlayList> GetPlayList_Function()
        {
            return CoreData.GetPlayList();
        }
        /// <summary>
        /// 改变播放列表
        /// </summary>
        public bool ChangePlayList_Function(PlayList list)
        {
            return CoreData.ChangePlayList(list);
        }
        /// <summary>
        /// 添加播放列表
        /// </summary>
        public bool AddPlayList_Function(PlayList list)
        {
            return CoreData.AddPlayList(list);
        }
        /// <summary>
        /// 删除播放列表
        /// </summary>
        public bool DeletePlayList_Function(PlayList list)
        {
            return CoreData.DeletePlayList(list);
        }

        /// <summary>
        /// 获取指定的播放列表
        /// </summary>
        public PlayList GetPlayListForGuid_Function(Guid guid)
        {
            return CoreData.GetPlayListForGuid(guid);
        }
        /// <summary>
        /// 获取播放中的播放列表
        /// </summary>
        public PlayList GetPlayingPlayList_Function()
        {
            return CoreData.GetPlayingPlayList();
        }
        #endregion

        #region Dictionary

        /// <summary>
        /// 获取Dictionary数据
        /// </summary>
        public object GetDictionaryData_Function(Guid guid)
        {
            return CoreData.GetDictionaryData(guid);
        }
        /// <summary>
        /// 添加Dictionary数据
        /// </summary>
        public bool AddDictionaryData_Function(Guid guid, object data)
        {
            return CoreData.AddDictionaryData(guid, data);
        }
        /// <summary>
        /// 改变Dictionary数据
        /// </summary>
        public bool ChangeDictionaryData_Function(Guid guid, object data)
        {
            return CoreData.ChangeDictionaryData(guid, data);
        }
        /// <summary>
        /// 删除Dictionary数据
        /// </summary>
        public bool DeleteDictionaryData_Function(Guid guid)
        {
            return CoreData.DeleteDictionaryData(guid);
        }
        /// <summary>
        /// 定向传输数据
        /// </summary>
        public void OrientationAction_Function(string mainkey, string key, object data)
        {
            CoreData.TransmitOrientationAction(mainkey, key, data);
        }

        #endregion

        #endregion

        /// <summary>
        /// 初始化ActionParam
        /// </summary>
        public void InitActionParam()
        {
            #region Input

            #region Base

            // 自动执行动作接口
            ActionData.AddParam(
               typeof(MusicPlayerPlus.Core.Reflection.Action.Input.RAutoExecuteAction),
                 new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Input.APAutoExecuteAction()
                 {
                     AutoExecute = (action) =>
                     {
                         AutoExecute_Event += action;
                     }
                 }
               );
            // 添加按钮动作接口
            ActionData.AddParam(
               typeof(MusicPlayerPlus.Core.Reflection.Action.Input.RAddToButtonAction),
                 new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Input.APAddToButtonAction()
                 {
                     AddToButton = (action) =>
                     {
                         AddToButton_Event += action;
                     }
                 }
               );
            //添加菜单动作接口
            ActionData.AddParam(
                typeof(MusicPlayerPlus.Core.Reflection.Action.Input.RAddToMenuAction),
                  new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Input.APAddToMenuAction()
                  {
                      AddToMenu = (action) =>
                      {
                          AddToMenu_Event += action;
                      }
                  }
                );
            //设置主窗体
            ActionData.AddParam(
                typeof(MusicPlayerPlus.Core.Reflection.Action.Input.RSetMainWindow),
                  new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Input.APSetMainWindow()
                  {
                      SetMainWindow = (action) =>
                      {
                          SetMainWindow_Event += action;
                      }
                  }
                );
            //主窗体 显示
            ActionData.AddParam(
                typeof(MusicPlayerPlus.Core.Reflection.Action.Input.RMainWindowShow),
                  new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Input.APMainWindowShow()
                  {
                      MainWindowShow = (action) =>
                      {
                          MainWindowShow_Event += action;
                      }
                  }
                );
            //主窗体 隐藏
            ActionData.AddParam(
                typeof(MusicPlayerPlus.Core.Reflection.Action.Input.RMainWindowHide),
                  new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Input.APMainWindowHide()
                  {
                      MainWindowHide = (action) =>
                      {
                          MainWindowHide_Event += action;
                      }
                  }
                );

            //主窗体 最小化
            ActionData.AddParam(
                typeof(MusicPlayerPlus.Core.Reflection.Action.Input.RMainWindowMin),
                  new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Input.APMainWindowMin()
                  {
                      MainWindowMin = (action) =>
                      {
                          MainWindowMin_Event += action;
                      }
                  }
                );

            //主窗体 最大化
            ActionData.AddParam(
                typeof(MusicPlayerPlus.Core.Reflection.Action.Input.RMainWindowMax),
                  new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Input.APMainWindowMax()
                  {
                      MainWindowMax = (action) =>
                      {
                          MainWindowMax_Event += action;
                      }
                  }
                );
            #endregion

            #region Media

            // (改变后事件)进度条改变
            ActionData.AddParam(
               typeof(MusicPlayerPlus.Core.Reflection.Action.Input.RTimeLineChangeAction),
                 new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Input.APTimeLineChangeAction()
                 {
                     TimeLineChange = (action) =>
                     {
                         TimeLineChange_Event += action;
                     }
                 }
               );
            // (主动)进度条改变
            ActionData.AddParam(
               typeof(MusicPlayerPlus.Core.Reflection.Action.Input.RChangeTimeLineAction),
                 new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Input.APChangeTimeLineAction()
                 {
                     ChangeTimeLine = (action) =>
                     {
                         ChangeTimeLine_Event += action;
                     }
                 }
               );
            // 缓冲进度条改变
            ActionData.AddParam(
               typeof(MusicPlayerPlus.Core.Reflection.Action.Input.RBufferingTimeLineChangeAction),
                 new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Input.APBufferingTimeLineChangeAction()
                 {
                     BufferingTimeLineChange = (action) =>
                     {
                         BufferingTimeLineChange_Event += action;
                     }
                 }
               );
            // (改变后事件)音量改变
            ActionData.AddParam(
               typeof(MusicPlayerPlus.Core.Reflection.Action.Input.RVolumeChangeAction),
                 new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Input.APVolumeChangeAction()
                 {
                     VolumeChange = (action) =>
                     {
                         VolumeChange_Event += action;
                     }
                 }
               );
            // (主动)音量改变
            ActionData.AddParam(
               typeof(MusicPlayerPlus.Core.Reflection.Action.Input.RChangeVolumeAction),
                 new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Input.APChangeVolumeAction()
                 {
                     ChangeVolume = (action) =>
                     {
                         ChangeVolume_Event += action;
                     }
                 }
               );
            // 播放状态改变
            ActionData.AddParam(
               typeof(MusicPlayerPlus.Core.Reflection.Action.Input.RPlayStateChangeAction),
                 new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Input.APPlayStateChangeAction()
                 {
                     PlayStateChange = (action) =>
                     {
                         PlayStateChange_Event += action;
                     }
                 }
               );
            //播放顺序改变
            ActionData.AddParam(
               typeof(MusicPlayerPlus.Core.Reflection.Action.Input.RPlayOrderChangeAction),
                 new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Input.APPlayOrderChangeAction()
                 {
                     PlayPlayOrderChange = (action) =>
                     {
                         PlayPlayOrderChange_Event += action;
                     }
                 }
               );
            //播放
            ActionData.AddParam(
               typeof(MusicPlayerPlus.Core.Reflection.Action.Input.RPlayAction),
                 new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Input.APPlayAction()
                 {
                     Play = (action) =>
                     {
                         Play_Event += action;
                     }
                 }
               );
            //暂停
            ActionData.AddParam(
               typeof(MusicPlayerPlus.Core.Reflection.Action.Input.RPauseAction),
                 new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Input.APPauseAction()
                 {
                     Pause = (action) =>
                     {
                         Pause_Event += action;
                     }
                 }
               );
            //停止
            ActionData.AddParam(
               typeof(MusicPlayerPlus.Core.Reflection.Action.Input.RStopAction),
                 new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Input.APStopAction()
                 {
                     Stop = (action) =>
                     {
                         Stop_Event += action;
                     }
                 }
               );
            //上一首
            ActionData.AddParam(
               typeof(MusicPlayerPlus.Core.Reflection.Action.Input.RPreviousTrackAction),
                 new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Input.APPreviousTrackAction()
                 {
                     PreviousTrack = (action) =>
                     {
                         PreviousTrack_Event += action;
                     }
                 }
               );
            //下一首
            ActionData.AddParam(
               typeof(MusicPlayerPlus.Core.Reflection.Action.Input.RNextTrackAction),
                 new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Input.APNextTrackAction()
                 {
                     NextTrack = (action) =>
                     {
                         NextTrack_Event += action;
                     }
                 }
               );

            #endregion

            #region Data

            // Dictionary数据改变时
            ActionData.AddParam(
               typeof(MusicPlayerPlus.Core.Reflection.Action.Input.RDictionaryChange),
                 new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Input.APDictionaryChange()
                 {
                     DictionaryChange = (action) =>
                     {
                         DictionaryChange_Event += action;
                     }
                 }
               );
            // 播放列表改变时
            ActionData.AddParam(
               typeof(MusicPlayerPlus.Core.Reflection.Action.Input.RPlayListChange),
                 new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Input.APPlayListChange()
                 {
                     PlayListChange = (action) =>
                     {
                         PlayListChange_Event += action;
                     }
                 }
               );
            // 播放中的列表改变时
            ActionData.AddParam(
               typeof(MusicPlayerPlus.Core.Reflection.Action.Input.RMuiscListChange),
                 new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Input.APMuiscListChange()
                 {
                     MuiscListChange = (action) =>
                     {
                         MuiscListChange_Event += action;
                     }
                 }
               );
            // 播放的歌曲改变时
            ActionData.AddParam(
               typeof(MusicPlayerPlus.Core.Reflection.Action.Input.RPlayMusicChange),
                 new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Input.APPlayMusicChange()
                 {
                     PlayMusicChange = (action) =>
                     {
                         PlayMusicChange_Event += action;
                     }
                 }
               );


            // 定向通道被触发
            ActionData.AddParam(
               typeof(MusicPlayerPlus.Core.Reflection.Action.Input.ROrientationActionChange),
                 new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Input.APOrientationActionChange()
                 {
                     OrientationActionChange = (key, action) =>
                     {
                         CoreData.AddToOrientationAction(key, action);
                     }
                 }
               );
            #endregion

            #endregion

            #region Output

            #region Base

            /// <summary>
            /// 添加按钮动作接口
            /// </summary>
            ActionData.AddParam(
              typeof(MusicPlayerPlus.Core.Reflection.Action.Output.RAddToButtonAction),
                new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Output.APAddToButtonAction()
                {
                    AddToButton = AddToButton_Function
                }
              );
            /// <summary>
            /// 添加菜单动作接口
            /// </summary>
            ActionData.AddParam(
                typeof(MusicPlayerPlus.Core.Reflection.Action.Output.RAddToMenuAction),
                  new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Output.APAddToMenuAction()
                  {
                      AddToMenu = AddToMenu_Function
                  }
                );
            /// <summary>
            /// 输出信息到日志接口
            /// </summary>
            ActionData.AddParam(
                typeof(MusicPlayerPlus.Core.Reflection.Action.Output.RInputLogAction),
                  new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Output.APInputLogAction()
                  {
                      InputLog = InputLog_Function
                  }
                );
            /// <summary>
            /// 设置主窗体
            /// </summary>
            ActionData.AddParam(
                typeof(MusicPlayerPlus.Core.Reflection.Action.Output.RSetMainWindow),
                  new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Output.APSetMainWindow()
                  {
                      SetMainWindow = SetMainWindow_Function
                  }
                );
            /// <summary>
            /// 主窗体 显示
            /// </summary>
            ActionData.AddParam(
                typeof(MusicPlayerPlus.Core.Reflection.Action.Output.RMainWindowShow),
                  new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Output.APMainWindowShow()
                  {
                      MainWindowShow = MainWindowShow_Function
                  }
                );
            /// <summary>
            /// 主窗体 隐藏
            /// </summary>
            ActionData.AddParam(
                typeof(MusicPlayerPlus.Core.Reflection.Action.Output.RMainWindowHide),
                  new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Output.APMainWindowHide()
                  {
                      MainWindowHide = MainWindowHide_Function
                  }
                );
            /// <summary>
            /// 主窗体 最小化
            /// </summary>
            ActionData.AddParam(
                typeof(MusicPlayerPlus.Core.Reflection.Action.Output.RMainWindowMin),
                  new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Output.APMainWindowMin()
                  {
                      MainWindowMin = MainWindowMin_Event
                  }
                );
            /// <summary>
            /// 主窗体 最大化
            /// </summary>
            ActionData.AddParam(
                typeof(MusicPlayerPlus.Core.Reflection.Action.Output.RMainWindowMax),
                  new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Output.APMainWindowMax()
                  {
                      MainWindowMax = MainWindowMax_Event
                  }
                );

            #endregion

            #region Media

            /// <summary>
            /// (改变后事件)进度条改变
            /// </summary>
            ActionData.AddParam(
               typeof(MusicPlayerPlus.Core.Reflection.Action.Output.RTimeLineChangeAction),
                 new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Output.APTimeLineChangeAction()
                 {
                     TimeLineChange = TimeLineChange_Function
                 }
               );
            /// <summary>
            /// (主动)进度条改变
            /// </summary>
            ActionData.AddParam(
               typeof(MusicPlayerPlus.Core.Reflection.Action.Output.RChangeTimeLineAction),
                 new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Output.APChangeTimeLineAction()
                 {
                     ChangeTimeLine = ChangeTimeLine_Function
                 }
               );
            /// <summary>
            /// 缓冲进度条改变
            /// </summary>
            ActionData.AddParam(
               typeof(MusicPlayerPlus.Core.Reflection.Action.Output.RBufferingTimeLineChangeAction),
                 new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Output.APBufferingTimeLineChangeAction()
                 {
                     BufferingTimeLineChange = BufferingTimeLineChange_Function
                 }
               );
            /// <summary>
            /// (改变后事件)音量改变
            /// </summary>
            ActionData.AddParam(
               typeof(MusicPlayerPlus.Core.Reflection.Action.Output.RVolumeChangeAction),
                 new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Output.APVolumeChangeAction()
                 {
                     VolumeChange = VolumeChange_Function
                 }
               );
            /// <summary>
            /// (主动)音量改变
            /// </summary>
            ActionData.AddParam(
               typeof(MusicPlayerPlus.Core.Reflection.Action.Output.RChangeVolumeAction),
                 new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Output.APChangeVolumeAction()
                 {
                     ChangeVolume = ChangeVolume_Function
                 }
               );
            /// <summary>
            /// 播放状态改变
            /// </summary>
            ActionData.AddParam(
               typeof(MusicPlayerPlus.Core.Reflection.Action.Output.RPlayStateChangeAction),
                 new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Output.APPlayStateChangeAction()
                 {
                     PlayStateChange = PlayStateChange_Function
                 }
               );
            /// <summary>
            /// 播放顺序改变
            /// </summary>
            ActionData.AddParam(
               typeof(MusicPlayerPlus.Core.Reflection.Action.Output.RPlayOrderChangeAction),
                 new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Output.APPlayOrderChangeAction()
                 {
                     PlayPlayOrderChange = PlayPlayOrderChange_Function
                 }
               );
            /// <summary>
            /// 播放
            /// </summary>
            ActionData.AddParam(
               typeof(MusicPlayerPlus.Core.Reflection.Action.Output.RPlayAction),
                 new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Output.APPlayAction()
                 {
                     Play = Play_Function
                 }
               );
            /// <summary>
            /// 暂停
            /// </summary>
            ActionData.AddParam(
               typeof(MusicPlayerPlus.Core.Reflection.Action.Output.RPauseAction),
                 new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Output.APPauseAction()
                 {
                     Pause = Pause_Function
                 }
               );
            /// <summary>
            /// 停止
            /// </summary>
            ActionData.AddParam(
               typeof(MusicPlayerPlus.Core.Reflection.Action.Output.RStopAction),
                 new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Output.APStopAction()
                 {
                     Stop = Stop_Function
                 }
               );
            /// <summary>
            /// 上一首
            /// </summary>
            ActionData.AddParam(
               typeof(MusicPlayerPlus.Core.Reflection.Action.Output.RPreviousTrackAction),
                 new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Output.APPreviousTrackAction()
                 {
                     PreviousTrack = PreviousTrack_Function
                 }
               );
            /// <summary>
            /// 下一首
            /// </summary>
            ActionData.AddParam(
               typeof(MusicPlayerPlus.Core.Reflection.Action.Output.RNextTrackAction),
                 new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Output.APNextTrackAction()
                 {
                     NextTrack = NextTrack_Function
                 }
               );

            #endregion

            #region MusicList

            /// <summary>
            /// 获取列表
            /// </summary>
            ActionData.AddParam(
                typeof(MusicPlayerPlus.Core.Reflection.Action.Output.RGetMusicListAction),
                  new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Output.APGetMusicListAction()
                  {
                      GetMusicList = GetMusicList_Function
                  }
                );
            /// <summary>
            /// 改变列表
            /// </summary>
            ActionData.AddParam(
                typeof(MusicPlayerPlus.Core.Reflection.Action.Output.RChangeMusicListAction),
                  new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Output.APChangeMusicListAction()
                  {
                      ChangeMusicList = ChangeMusicList_Function
                  }
                );
            /// <summary>
            /// 添加列表
            /// </summary>
            ActionData.AddParam(
                typeof(MusicPlayerPlus.Core.Reflection.Action.Output.RAddMusicListAction),
                  new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Output.APAddMusicListAction()
                  {
                      AddMusicList = AddMusicList_Function
                  }
                );
            /// <summary>
            /// 获取播放的音乐
            /// </summary>
            ActionData.AddParam(
                typeof(MusicPlayerPlus.Core.Reflection.Action.Output.RGetPlayMusicAction),
                  new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Output.APGetPlayMusicAction()
                  {
                      GetPlayMusic = GetPlayMusic_Function
                  }
                );
            /// <summary>
            /// 设置播放的音乐
            /// </summary>
            ActionData.AddParam(
                typeof(MusicPlayerPlus.Core.Reflection.Action.Output.RSetPlayMusicAction),
                  new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Output.APSetPlayMusicAction()
                  {
                      SetPlayMusic = SetPlayMusic_Function
                  }
                );
            /// <summary>
            /// 添加歌曲
            /// </summary>
            ActionData.AddParam(
                typeof(MusicPlayerPlus.Core.Reflection.Action.Output.RAddMusicAction),
                  new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Output.APAddMusicAction()
                  {
                      AddMusic = AddMusic_Function
                  }
                );
            /// <summary>
            /// 改变歌曲
            /// </summary>
            ActionData.AddParam(
                typeof(MusicPlayerPlus.Core.Reflection.Action.Output.RChangeMusicAction),
                  new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Output.APChangeMusicAction()
                  {
                      ChangeMusic = ChangeMusic_Function
                  }
                );
            /// <summary>
            /// 删除歌曲
            /// </summary>
            ActionData.AddParam(
                typeof(MusicPlayerPlus.Core.Reflection.Action.Output.RDeleteMusicAction),
                  new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Output.APDeleteMusicAction()
                  {
                      DeleteMusic = DeleteMusic_Function
                  }
                );

            #endregion

            #region PlayList

            /// <summary>
            /// 获取所有的播放列表
            /// </summary>
            ActionData.AddParam(
                typeof(MusicPlayerPlus.Core.Reflection.Action.Output.RGetPlayListAction),
                  new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Output.APGetPlayListAction()
                  {
                      GetPlayList = GetPlayList_Function
                  }
                );
            /// <summary>
            /// 改变播放列表
            /// </summary>
            ActionData.AddParam(
                typeof(MusicPlayerPlus.Core.Reflection.Action.Output.RChangePlayListAction),
                  new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Output.APChangePlayListAction()
                  {
                      ChangePlayList = ChangePlayList_Function
                  }
                );
            /// <summary>
            /// 添加播放列表
            /// </summary>
            ActionData.AddParam(
                typeof(MusicPlayerPlus.Core.Reflection.Action.Output.RAddPlayListAction),
                  new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Output.APAddPlayListAction()
                  {
                      AddPlayList = AddPlayList_Function
                  }
                );
            /// <summary>
            /// 删除播放列表
            /// </summary>
            ActionData.AddParam(
                typeof(MusicPlayerPlus.Core.Reflection.Action.Output.RDeletePlayListAction),
                  new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Output.APDeletePlayListAction()
                  {
                      DeletePlayList = DeletePlayList_Function
                  }
                );
            /// <summary>
            /// 获取指定的播放列表
            /// </summary>
            ActionData.AddParam(
                typeof(MusicPlayerPlus.Core.Reflection.Action.Output.RGetPlayListForGuidAction),
                  new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Output.APGetPlayListForGuidAction()
                  {
                      GetPlayListForGuid = GetPlayListForGuid_Function
                  }
                );
            /// <summary>
            /// 播放中的列表
            /// </summary>
            ActionData.AddParam(
                typeof(MusicPlayerPlus.Core.Reflection.Action.Output.RGetPlayingPlayListAction),
                  new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Output.APGetPlayingPlayListAction()
                  {
                      GetPlayingPlayList = GetPlayingPlayList_Function
                  }
                );
            #endregion

            #region Dictionary

            /// <summary>
            /// 获取Dictionary数据
            /// </summary>
            ActionData.AddParam(
                typeof(MusicPlayerPlus.Core.Reflection.Action.Output.RGetDictionaryData),
                  new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Output.APGetDictionaryData()
                  {
                      GetDictionaryData = GetDictionaryData_Function
                  }
                );
            /// <summary>
            /// 添加Dictionary数据
            /// </summary>
            ActionData.AddParam(
                typeof(MusicPlayerPlus.Core.Reflection.Action.Output.RAddDictionaryData),
                  new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Output.APAddDictionaryData()
                  {
                      AddDictionaryData = AddDictionaryData_Function
                  }
                );
            /// <summary>
            /// 改变Dictionary数据
            /// </summary>
            ActionData.AddParam(
                typeof(MusicPlayerPlus.Core.Reflection.Action.Output.RChangeDictionaryData),
                  new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Output.APChangeDictionaryData()
                  {
                      ChangeDictionaryData = ChangeDictionaryData_Function
                  }
                );
            /// <summary>
            /// 删除Dictionary数据
            /// </summary>
            ActionData.AddParam(
                typeof(MusicPlayerPlus.Core.Reflection.Action.Output.RDeleteDictionaryData),
                  new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Output.APDeleteDictionaryData()
                  {
                      DeleteDictionaryData = DeleteDictionaryData_Function
                  }
                );
            /// <summary>
            /// 触发定向通道
            /// </summary>
            ActionData.AddParam(
                typeof(MusicPlayerPlus.Core.Reflection.Action.Output.ROrientationAction),
                  new MusicPlayerPlus.Core.Reflection.ActionParam.Action.Output.APOrientationAction()
                  {
                      OrientationAction = OrientationAction_Function
                  }
                );

            #endregion

            #endregion
        }

        #endregion

        /// <summary>
        /// 自动执行代码
        /// </summary>
        public void AutoExecute()
        {
            if (AutoExecute_Event != null)
            {
                AutoExecute_Event();
            }
        }
    }
}
